package com.common.library.data;

import java.util.ArrayList;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;

import com.common.library.util.LogUtil;
import com.common.library.util.NetworkHelper;

/**
 * 
 * function: POST请求：没有提示信息的事件处理: 用来即使报错也没关系的数据请求处理
 *
 * @author  aXiBa
 */
public class EventHandler2Post extends CommonEventHandler {
	
	private static final String TAG = EventHandler2Post.class.getSimpleName();
	
	
	public EventHandler2Post(String url, ArrayList<NameValuePair> params, String useragent1, ResultHandlerInEvent resultHandler) {
		
		this.url = url;
		this.params = params;
		this.useragent1 = useragent1;
		this.resultHandler = resultHandler;
		
		execRequest();
	}
	
	public EventHandler2Post(String url, ArrayList<NameValuePair> params, String useragent1, ResultHandlerInEvent resultHandler, boolean isEncrypt) {
		
		this.url = url;
		this.params = params;
		this.useragent1 = useragent1;
		this.resultHandler = resultHandler;
		this.isEncrypt = isEncrypt;
		
		execRequest();
	}
	
	
	@Override
	public HttpResponse doRequest() throws Exception {
		LogUtil.i(TAG, url);
		return NetworkHelper.sendHttpPostString(url, params, useragent1);
	}

}
